package com.adresvseti.wallpaperoid.models;

import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;

public class Wallpaper implements Parcelable {
	
    public final int id;
    public String thumbUrl;
    public Bitmap thumbBitmap;
    public int thumbResId;
    
    public Wallpaper(int id, String thumbUrl) {
        this.id = id;
        this.thumbUrl = thumbUrl;
    }
    
    public Wallpaper(int id, int resId) {
        this.id = id;
        this.thumbResId = resId;
    }
    
    private Wallpaper(Parcel in) {
        id = in.readInt();
        thumbUrl = in.readString();
        thumbBitmap = in.readParcelable(getClass().getClassLoader());
        thumbResId = in.readInt();
    }

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeInt(id);
        out.writeString(thumbUrl);
        out.writeParcelable(thumbBitmap, flags);
        out.writeInt(thumbResId);
	}
	
	
	public static final Parcelable.Creator<Wallpaper> CREATOR = new Parcelable.Creator<Wallpaper>() {
        public Wallpaper createFromParcel(Parcel in) {
            return new Wallpaper(in);
        }

        public Wallpaper[] newArray(int size) {
            return new Wallpaper[size];
        }
    };
}
